﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;

namespace CentrifugalSealCalc
{
    public static class Program
    {

        public readonly static string FilePathExpellers = Path.Combine(Path.GetTempPath(), "Expellers.csv");
        public readonly static string FilePathImpellersOpen = Path.Combine(Path.GetTempPath(), "ImpellersOpen.csv");
        public readonly static string FilePathImpellersClosed = Path.Combine(Path.GetTempPath(), "ImpellersClosed.csv"); 

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        public static void ExtractResource(string name, string fpDest)
        {
            try
            {
                System.Reflection.Assembly oAsm = System.Reflection.Assembly.GetExecutingAssembly();

                string fn = "";
                foreach (string n in oAsm.GetManifestResourceNames())
                {
                    if (n.Contains(name))
                    {
                        fn = n;
                        break;
                    }
                }
                Stream oStrm = oAsm.GetManifestResourceStream(fn);
                byte[] buffer = new byte[oStrm.Length];
                oStrm.Read(buffer, 0, buffer.Length);
                using (BinaryWriter sw = new BinaryWriter(File.Open(fpDest, FileMode.Create)))
                {
                    sw.Write(buffer);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                // DebugHelper.WriteException(ex, "Error while getting text from resource");
            }
        }
    }
}